package org.example.myleet.p707;

import org.example.myleet.Utils.Assert;

public class Main {
    public static void main(String[] args) {
        MyLinkedList linkedList = new MyLinkedList();
        //example-1
//        linkedList.addAtHead(1);
//        linkedList.addAtTail(3);
//        linkedList.addAtIndex(1, 2);
//        Assert.isTrue(2 == linkedList.get(1));
//        linkedList.deleteAtIndex(1);
//        Assert.isTrue(3 == linkedList.get(1));
//        linkedList.addAtHead(2);
//        linkedList.addAtHead(4);
//        linkedList.addAtHead(6);
//        linkedList.addAtIndex(1, 5);
//        linkedList.deleteAtIndex(2);
//        Assert.isTrue(-1 == linkedList.get(5));
//        Assert.isTrue(3 == linkedList.get(4));

        //example-2
        linkedList.addAtHead(7);
        linkedList.addAtHead(2);
        linkedList.addAtHead(1);
        linkedList.addAtIndex(3,0);
        linkedList.deleteAtIndex(2);
        linkedList.addAtHead(6);
        linkedList.addAtTail(4);
        Assert.isTrue(4 == linkedList.get(4));
        linkedList.addAtHead(4);
        linkedList.addAtIndex(5, 0);
        linkedList.addAtHead(6);
        linkedList.deleteAtIndex(0);
        linkedList.deleteAtIndex(0);
        linkedList.deleteAtIndex(0);
        linkedList.deleteAtIndex(0);
        linkedList.deleteAtIndex(0);
        linkedList.deleteAtIndex(0);
        linkedList.deleteAtIndex(0);
        linkedList.deleteAtIndex(0);
        Assert.isTrue(-1 == linkedList.get(0));
    }
}
